/*
 * start_end_stationlist.h
 *
 *  Created on: 2013-2-18
 *      Author: panqiuhui
 */

#ifndef START_END_STATIONLIST_H_
#define START_END_STATIONLIST_H_

#include <stdbool.h>
#include "traininfo.h"

struct train_start_end_stationinfo {
	char trainID[TRAINS_TRAINID_LEN];
	char startStation[STATIONS_STATION_NAME_LEN];
	char endStation[STATIONS_STATION_NAME_LEN];
	char startTime[THROUGH_STATIONS_DEPART_TIME_LEN];
	char endTime[THROUGH_STATIONS_ARRIVE_TIME_LEN];
	char consumeTime[THROUGH_STATIONS_CONSUME_TIME_LEN];
	char departStation[TRAINS_DEPARTSTATIONS_LEN];
	char arriveStation[TRAINS_ARRIVESTATIONS_LEN];
	char price[THROUGH_STATIONS_PRICE_LEN];
};

typedef struct train_start_end_stationinfo StartEndStationItem;

typedef struct start_end_station_node {
	StartEndStationItem item;
	struct start_end_station_node *next;
} StartEndStationNode;

typedef StartEndStationNode * StartEndStationList;

void InitializeListStartEndStation(StartEndStationList * plist);

bool ListIsEmptyStartEndStation(const StartEndStationList * plist);

bool ListIsFullStartEndStation(const StartEndStationList * plist);

unsigned int ListItemCountStartEndStation(const StartEndStationList * plist);

bool AddItemStartEndStation(StartEndStationItem item,
		StartEndStationList *plist);

void TraverseStartEndStation(const StartEndStationList * plist,
		void (*pfun)(StartEndStationItem item));

void EmptyTheListStartEndStation(StartEndStationList * plist);

#endif /* START_END_STATIONLIST_H_ */
